<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1,IE=9">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="LEUR DE CHINE">
    <meta name="keywords"
          content="china reds,china blues,cashmere,corduroy,little bag,tartans,tweeds,stars,stripes,linen,leather,tassel travel bag,tartan,accessories">
    <title>上药神象农业物联网监控系统</title>
    <!--[if lte IE 8]>
    <script>window.location.href = 'http://cdn.dmeng.net/upgrade-your-browser.html?referrer=' + location.href;</script>
    <![endif]-->
    <script type="text/javascript" src="${basePath}/pc/lib/respond/respond.src.js"></script>
    <link href="${basePath}/pc/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="${basePath}/pc/css/font-awesome.min.css" rel="stylesheet">
    <link href="${basePath}/pc/lib/iconfont/css/iconfont.css" rel="stylesheet">
    <link href="${basePath}/pc/css/main.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="${basePath}/pc/lib/bootstrap/js/html5shiv.min.js"></script>
    <script src="${basePath}/pc/lib/bootstrap/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="wrp">
    <nav class="navbar navbar-inverse cm_nav">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                        aria-expanded="false" aria-controls="navbar">
                    <span class="sr-only">navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="${basePath}/pc/user/main">
                    <img src="${basePath}/pc/img/logo_white.png" class="img-responsive">
                </a>
            </div>
            <div id="navbar" class="collapse navbar-collapse">
                <ul class="nav navbar-nav mnav">
                    <li class="active">
                        <a href="${basePath}/pc/user/main">监控数据</a>
                    </li>
                    <li>
                        <a href="${basePath}/function/pc/farmwork">农事记录</a>
                    </li>
                </ul>
                <ul class="navbar-nav navbar-right smenu">
                    <li class="wl_fnt">
                        <a><i class="iconfont icon-account"></i>欢迎：<span class="username"></span></a>
                    </li>
                    <li class="ext_lnk">
                        <a href="${basePath}/logout"><i class="iconfont icon-exit1"></i>退出</a>
                    </li>
                </ul>

            </div>
            <!--/.nav-collapse -->
        </div>
    </nav>

    <div class="pgc">
        <div class="container">
            <div class="cls">
                <div class="tbar">
                    <a href="javascript:history.go(-1);" class="bk_lnk"><i class="iconfont icon-left"></i></a>
                    <div class="dropdown slt_eqm">
                        <a id="dLabel" role="button" data-toggle="dropdown" class="btn btn-default" data-target="#"
                           href="javascript:;">
                            --- 请选择设备 --- <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
                            <li class="dropdown-submenu" data-stopPropagation="true">
                                <a tabindex="-1" href="javascript:;">传感器组</a>
                                <ul class="dropdown-menu sensorGroup"></ul>
                            </li>
                            <li class="dropdown-submenu" data-stopPropagation="true">
                                <a tabindex="-1" href="javascript:;">水体EC</a>
                                <ul class="dropdown-menu ec"></ul>
                            </li>
                            <li class="dropdown-submenu" data-stopPropagation="true">
                                <a tabindex="-1" href="javascript:;">枪机</a>
                                <ul class="dropdown-menu qj"></ul>
                            </li>
                            <li class="dropdown-submenu" data-stopPropagation="true">
                                <a tabindex="-1" href="javascript:;">球机</a>
                                <ul class="dropdown-menu uj"></ul>
                            </li>
                        </ul>
                    </div>

                    <!--dropdown end-->
                    <div class="clr-b"></div>
                </div>
                <!--tbar end-->
                <div class="cnt_pd">
                    <h2 class="ctit"><i class="iconfont icon-thermometer"></i>
                        传感器组${index}号设备
                    </h2>
                    <div class="data_lst">
                        <div class="dt_itm">
                            <div class="itm_cnt">
                                <ul>
                                    <li class="text-center"><i class="iconfont icon-water"></i></li>
                                    <li class="text-center">
                                        <spn class="itm_tit">空气温湿度传感器</spn>
                                    </li>
                                    <li>温度：<span class="red_fnt wendu"></span></li>
                                    <li>湿度：<span class="blue_fnt shidu"></span></li>
                                    <span class="mraw"><i class="iconfont icon-arrow-right"></i></span>
                                </ul>
                                <div class="mr">
                                    <a href="${basePath}/function/pc/sensorDetail?index=${index}&id=${id}&type=1">更多</a>
                                </div>
                            </div>
                        </div>
                        <!--dt_itm end-->
                        <div class="dt_itm">
                            <div class="itm_cnt">
                                <ul>
                                    <li class="text-center"><i class="iconfont icon-co2"></i></li>
                                    <li class="text-center">
                                        <spn class="itm_tit">CO2传感器</spn>
                                    </li>
                                    <li>浓度：<span class="blue_fnt nongdu"></span></li>
                                    <span class="mraw"><i class="iconfont icon-arrow-right"></i></span>
                                </ul>
                                <div class="mr">
                                    <a href="${basePath}/function/pc/sensorDetail?index=${index}&id=${id}&type=2">更多</a>
                                </div>
                            </div>
                        </div>
                        <!--dt_itm end-->
                        <div class="dt_itm">
                            <div class="itm_cnt last_ul">
                                <ul>
                                    <li class="text-center"><i class="iconfont icon-sun"></i></li>
                                    <li class="text-center">
                                        <spn class="itm_tit">光照传感器</spn>
                                    </li>
                                    <li>照度：<span class="blue_fnt light"></span></li>
                                    <span class="mraw"><i class="iconfont icon-arrow-right"></i></span>
                                </ul>
                                <div class="mr">
                                    <a href="${basePath}/function/pc/sensorDetail?index=${index}&id=${id}&type=3">更多</a>
                                </div>
                                <!--mr end-->
                            </div>
                            <!--itm_cnt end-->
                        </div>
                        <!--dt_itm end-->
                        <div class="clr-b"></div>
                    </div>
                    <!--data_lst end-->
                </div>
                <!--cls_cnt end-->
            </div>
            <!--cls end-->
        </div>
    </div>
    <!--pgc end-->
    <footer class="ftr">Copyright<span class="cpy">&copy;</span>2017 上海上药神象健康药业有限公司</footer>
</div>
<!--wrp end-->
<script src="${basePath}/pc/lib/jquery/jquery.min.js"></script>
<script src="${basePath}/pc/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="${basePath}/common/js/common.js"></script>
<script src="${basePath}/common/js/ajax.js"></script>
<script src="${basePath}/common/js/form.js"></script>
<script src="${basePath}/pc/js/custom.js"></script>
<script>
    $(function () {
        AsyncGet("${basePath}/pc/user/getUserRole", null, function (value) {
            $(".username").text(value.data.username);
        })
        AsyncGet("${basePath}/pc/sensor/thSn", {id:"${id}"}, function (value) {
            if(value.data.length>0){
                $(".wendu").text(value.data[0].value+value.data[0].unit);
                $(".shidu").text(value.data[1].value+value.data[1].unit);
            }else{
                $(".wendu").text("");
                $(".shidu").text("");
            }
        })
        AsyncGet("${basePath}/pc/sensor/co2Sn", {id:"${id}"}, function (value) {
            if(value.data.length>0){
                $(".nongdu").text(value.data[0].value+value.data[0].unit);
            }else{
                $(".nongdu").text("");
            }
        })
        AsyncGet("${basePath}/pc/sensor/lightSn", {id:"${id}"}, function (value) {
            if(value.data.length>0){
                $(".light").text(value.data[0].value+value.data[0].unit);
            }else{
                $(".light").text("");
            }
        })

        function loadUser(url,indexName,redirect,ul) {
            AsyncGet(url,null,function (value) {
                for(var i=0;i<value.data.length;i++){
                    var index=value.data[i][indexName];
                    var id=value.data[i].id;
                    var li=$("<li></li>");
                    var a=$("<a></a>");
                    a.text(index+"号");
                    a.attr("href",redirect+"?index="+index+"&id="+id);
                    li.append(a);
                    ul.append(li);
                }
            })
        }
        loadUser("${basePath}/pc/sensor/getUserSensorGroupList","sensorGroupIndex",
            "${basePath}/function/pc/sensor",$(".dropdown-menu.sensorGroup"));
        loadUser("${basePath}/pc/sensor/getUserECList","sensorGroupIndex",
            "${basePath}/function/pc/ec",$(".dropdown-menu.ec"));
        loadUser("${basePath}/pc/monitor/getUserQjMonitorList","probeIndex",
            "${basePath}/function/pc/monitor",$(".dropdown-menu.qj"));
        loadUser("${basePath}/pc/monitor/getUserUjMonitorList","probeIndex",
            "${basePath}/function/pc/monitor",$(".dropdown-menu.uj"));
    })
</script>
</body>
</html>